package gui2.g1;

import java.util.ArrayList;
import java.util.List;

public class ChatModel {

	private List<ChatMessage> messages = new ArrayList<ChatMessage>();;
	
	private List<ChatListener> listeners = new ArrayList<ChatListener>();
	
	public void addChatListener(ChatListener l){
		listeners.add(l);
	}
	
	public void addMessage(ChatMessage m){
		messages.add(m);
		for(ChatListener l : listeners){
			l.messageAdded(messages);
		}
	}
}
